/*    */ package com.zimbra.cs.servlet;
/*    */ 
/*    */ import com.zimbra.common.util.Log;
/*    */ import com.zimbra.common.util.ZimbraLog;
/*    */ import java.io.IOException;
/*    */ import javax.servlet.Filter;
/*    */ import javax.servlet.FilterChain;
/*    */ import javax.servlet.FilterConfig;
/*    */ import javax.servlet.ServletException;
/*    */ import javax.servlet.ServletRequest;
/*    */ import javax.servlet.ServletResponse;
/*    */ import javax.servlet.http.HttpServletRequest;
/*    */ import javax.servlet.http.HttpServletResponse;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class RequestStringFilter
/*    */   implements Filter
/*    */ {
/*    */   public void destroy() {}
/*    */   
/*    */   public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
/*    */     throws IOException, ServletException
/*    */   {
/* 41 */     if ((request instanceof HttpServletRequest)) {
/* 42 */       HttpServletRequest httpReq = (HttpServletRequest)request;
/* 43 */       if ((httpReq.getQueryString() != null) && (httpReq.getQueryString().matches(".*(%00|\\x00).*"))) {
/* 44 */         ZimbraLog.misc.warn("Rejecting request containing null character in query string");
/* 45 */         ((HttpServletResponse)response).sendError(400);
/* 46 */         return;
/*    */       }
/* 48 */       if ((httpReq.getRequestURI() != null) && (httpReq.getRequestURI().matches(".*(%00|\\x00).*"))) {
/* 49 */         ZimbraLog.misc.warn("Rejecting request containing null character in URI");
/* 50 */         ((HttpServletResponse)response).sendError(400);
/* 51 */         return;
/*    */       }
/*    */     }
/* 54 */     chain.doFilter(request, response);
/*    */   }
/*    */   
/*    */   public void init(FilterConfig filterConfig)
/*    */     throws ServletException
/*    */   {}
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/servlet/RequestStringFilter.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */